/*
 * Decompiled with CFR 0.150.
 * 
 * Could not load the following classes:
 *  cn.hutool.core.collection.CollUtil
 *  cn.hutool.core.date.DateUtil
 *  cn.hutool.core.util.StrUtil
 *  com.alibaba.fastjson.JSON
 *  de.felixroske.jfxsupport.FXMLController
 *  javafx.fxml.FXML
 *  javafx.fxml.FXMLLoader
 *  javafx.fxml.Initializable
 *  javafx.scene.Parent
 *  javafx.scene.Scene
 *  javafx.scene.control.Alert
 *  javafx.scene.control.Alert$AlertType
 *  javafx.scene.control.ScrollPane
 *  javafx.scene.control.TextField
 *  javafx.scene.layout.VBox
 *  javafx.stage.Stage
 */
package com.gys.controller.rechargecard;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.gys.common.business.RechargeCardUtil;
import com.gys.common.data.HttpJson;
import com.gys.common.util.CacheUtil;
import com.gys.controller.BaseController;
import com.gys.data.enumclass.RechargeCardStatus;
import com.gys.data.enumclass.Sex;
import com.gys.data.example.GetLoginStoreOutData;
import com.gys.data.rechargecard.GaiaSdRechargeCardLoseInData;
import com.gys.data.rechargecard.RechargeCardInData;
import com.gys.data.rechargecard.RechargeCardOutData;
import de.felixroske.jfxsupport.FXMLController;
import java.io.IOException;
import java.net.URL;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.TextField;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

@FXMLController
public class RechargeCardLostController
extends BaseController
implements Initializable {
    @FXML
    private ScrollPane scrollPane;
    @FXML
    private VBox vBox;
    @FXML
    private TextField nameQuery;
    @FXML
    private TextField mobileQuery;
    @FXML
    private TextField cardNoQuery;
    @FXML
    private TextField name;
    @FXML
    private TextField sex;
    @FXML
    private TextField mobile;
    @FXML
    private TextField tel;
    @FXML
    private TextField amt;
    @FXML
    private TextField status;
    @FXML
    private TextField cardNo;
    @FXML
    private TextField lostBrandName;
    @FXML
    private TextField lostDate;
    @FXML
    private TextField lostTime;
    @FXML
    private TextField lostReason;
    @FXML
    private TextField unLostBrandName;
    @FXML
    private TextField unLostDate;
    @FXML
    private TextField unLostTime;
    @FXML
    private TextField unLostReason;
    private Stage stg;
    private boolean isForward;
    private static final String LOSE_STATUS = "1";
    private static final String UNLOSE_STATUS = "2";

    public void initialize(URL location, ResourceBundle resources) {
        this.scrollPane.setPrefWidth(this.getContentWidth());
        this.scrollPane.setPrefHeight(this.getContentHeight());
        this.vBox.setPrefWidth(this.getContentWidth());
        this.vBox.setPrefHeight(this.getContentHeight());
        this.lostBrandName.setText(((GetLoginStoreOutData)CacheUtil.get("store")).getStoName());
        this.unLostBrandName.setText(((GetLoginStoreOutData)CacheUtil.get("store")).getStoName());
        this.initDateTime();
    }

    private void initDateTime() {
        Date now = new Date();
        String date = DateUtil.format((Date)now, (String)"yyyyMMdd");
        String time = DateUtil.format((Date)now, (String)"HHmmss");
        this.lostDate.setText(date);
        this.lostTime.setText(time);
        this.unLostDate.setText(date);
        this.unLostTime.setText(time);
    }

    @FXML
    public void queryCardInfo() {
        Alert alert = this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", null);
        RechargeCardInData inData = new RechargeCardInData();
        inData.setGsrcId(this.cardNoQuery.getText());
        inData.setGsrcName(this.nameQuery.getText());
        inData.setGsrcMobile(this.mobileQuery.getText());
        if (StrUtil.isBlank((CharSequence)inData.getGsrcId()) && StrUtil.isBlank((CharSequence)inData.getGsrcName()) && StrUtil.isBlank((CharSequence)inData.getGsrcMobile())) {
            alert.setContentText("\u5fc5\u987b\u81f3\u5c11\u586b\u5199\u4e00\u9879\u5185\u5bb9\u8fdb\u884c\u67e5\u8be2\uff01");
            alert.showAndWait();
            return;
        }
        HttpJson rsp = RechargeCardUtil.getCardInfo(inData);
        if (rsp.isSuccess()) {
            List dataList = JSON.parseArray((String)rsp.getMsg(), RechargeCardOutData.class);
            if (CollUtil.isEmpty((Collection)dataList)) {
                this.name.setText("");
                this.sex.setText("");
                this.mobile.setText("");
                this.tel.setText("");
                this.amt.setText("");
                this.status.setText("");
                this.cardNo.setText("");
                alert.setContentText("\u672a\u67e5\u8be2\u5230\u76f8\u5173\u50a8\u503c\u5361");
                alert.showAndWait();
                return;
            }
            RechargeCardOutData outData = (RechargeCardOutData)dataList.get(0);
            this.name.setText(outData.getGsrcName());
            this.sex.setText(Sex.getName(outData.getGsrcSex()));
            this.mobile.setText(outData.getGsrcMobile());
            this.tel.setText(outData.getGsrcTel());
            this.amt.setText(outData.getGsrcAmt().toString());
            this.status.setText(RechargeCardStatus.getName(outData.getGsrcStatus()));
            this.cardNo.setText(outData.getGsrcId());
            this.initDateTime();
        } else {
            alert.setContentText(rsp.getMsg());
            alert.showAndWait();
        }
    }

    @FXML
    public void loseCard() {
        Alert alert = this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", null);
        GaiaSdRechargeCardLoseInData inData = new GaiaSdRechargeCardLoseInData();
        inData.setGsrclCardId(this.cardNo.getText());
        inData.setGsrclStatus(LOSE_STATUS);
        if (StrUtil.isBlank((CharSequence)inData.getGsrclCardId())) {
            alert.setContentText("\u8bf7\u5148\u67e5\u8be2\u50a8\u503c\u5361");
            alert.showAndWait();
            return;
        }
        inData.setGsrclDate(this.lostDate.getText());
        inData.setGsrclTime(this.lostTime.getText());
        inData.setGsrclReason(this.lostReason.getText());
        if (StrUtil.isNotBlank((CharSequence)inData.getGsrclReason()) && inData.getGsrclReason().length() > 30) {
            alert.setContentText("\u6302\u5931/\u89e3\u6302\u539f\u56e0\u957f\u5ea6\u4e0d\u8d85\u8fc730\u4f4d");
            alert.showAndWait();
            return;
        }
        HttpJson rsp = RechargeCardUtil.cardLost(inData);
        if (rsp.isSuccess()) {
            alert.setContentText("\u50a8\u503c\u5361\u5df2\u6302\u5931\u6210\u529f");
            alert.showAndWait();
            this.initDateTime();
        } else {
            alert.setContentText(rsp.getMsg());
            alert.showAndWait();
        }
    }

    @FXML
    public void unLostCard() {
        Alert alert = this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", null);
        GaiaSdRechargeCardLoseInData inData = new GaiaSdRechargeCardLoseInData();
        inData.setGsrclCardId(this.cardNo.getText());
        inData.setGsrclStatus(UNLOSE_STATUS);
        if (StrUtil.isBlank((CharSequence)inData.getGsrclCardId())) {
            alert.setContentText("\u8bf7\u5148\u67e5\u8be2\u50a8\u503c\u5361");
            alert.showAndWait();
            return;
        }
        inData.setGsrclDate(this.unLostDate.getText());
        inData.setGsrclTime(this.unLostTime.getText());
        inData.setGsrclReason(this.unLostReason.getText());
        if (StrUtil.isNotBlank((CharSequence)inData.getGsrclReason()) && inData.getGsrclReason().length() > 30) {
            alert.setContentText("\u6302\u5931/\u89e3\u6302\u539f\u56e0\u957f\u5ea6\u4e0d\u8d85\u8fc730\u4f4d");
            alert.showAndWait();
            return;
        }
        HttpJson rsp = RechargeCardUtil.cardLost(inData);
        if (rsp.isSuccess()) {
            alert.setContentText("\u50a8\u503c\u5361\u5df2\u89e3\u6302\u6210\u529f");
            alert.showAndWait();
            this.initDateTime();
        } else {
            alert.setContentText(rsp.getMsg());
            alert.showAndWait();
        }
    }

    @FXML
    public void toModifyPassword() throws IOException {
        Alert alert = this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", null);
        if (StrUtil.isBlank((CharSequence)this.cardNo.getText())) {
            alert.setContentText("\u8bf7\u5148\u67e5\u8be2\u50a8\u503c\u5361");
            alert.showAndWait();
            return;
        }
        this.isForward = true;
        Parent target = (Parent)FXMLLoader.load((URL)this.getClass().getResource("/fxml/rechargecard/passwordmodify.fxml"));
        Scene scene = new Scene(target);
        this.stg = new Stage();
        this.stg.setScene(scene);
        this.stg.show();
    }

    @FXML
    public void resetPassword() {
        Alert alert = this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", null);
        if (StrUtil.isBlank((CharSequence)this.cardNo.getText())) {
            alert.setContentText("\u8bf7\u5148\u67e5\u8be2\u50a8\u503c\u5361");
            alert.showAndWait();
            return;
        }
        RechargeCardInData inData = new RechargeCardInData();
        inData.setGsrcId(this.cardNo.getText());
        HttpJson rsp = RechargeCardUtil.resetPassword(inData);
        if (rsp.isSuccess()) {
            alert.setContentText("\u50a8\u503c\u5361\u5df2\u6210\u529f\u6062\u590d\u521d\u59cb\u5bc6\u7801");
            alert.showAndWait();
            this.initDateTime();
        } else {
            alert.setContentText(rsp.getMsg());
            alert.showAndWait();
        }
    }

    public ScrollPane getScrollPane() {
        return this.scrollPane;
    }

    public VBox getVBox() {
        return this.vBox;
    }

    public TextField getNameQuery() {
        return this.nameQuery;
    }

    public TextField getMobileQuery() {
        return this.mobileQuery;
    }

    public TextField getCardNoQuery() {
        return this.cardNoQuery;
    }

    public TextField getName() {
        return this.name;
    }

    public TextField getSex() {
        return this.sex;
    }

    public TextField getMobile() {
        return this.mobile;
    }

    public TextField getTel() {
        return this.tel;
    }

    public TextField getAmt() {
        return this.amt;
    }

    public TextField getStatus() {
        return this.status;
    }

    public TextField getCardNo() {
        return this.cardNo;
    }

    public TextField getLostBrandName() {
        return this.lostBrandName;
    }

    public TextField getLostDate() {
        return this.lostDate;
    }

    public TextField getLostTime() {
        return this.lostTime;
    }

    public TextField getLostReason() {
        return this.lostReason;
    }

    public TextField getUnLostBrandName() {
        return this.unLostBrandName;
    }

    public TextField getUnLostDate() {
        return this.unLostDate;
    }

    public TextField getUnLostTime() {
        return this.unLostTime;
    }

    public TextField getUnLostReason() {
        return this.unLostReason;
    }

    public Stage getStg() {
        return this.stg;
    }

    public boolean isForward() {
        return this.isForward;
    }

    public void setScrollPane(ScrollPane scrollPane) {
        this.scrollPane = scrollPane;
    }

    public void setVBox(VBox vBox) {
        this.vBox = vBox;
    }

    public void setNameQuery(TextField nameQuery) {
        this.nameQuery = nameQuery;
    }

    public void setMobileQuery(TextField mobileQuery) {
        this.mobileQuery = mobileQuery;
    }

    public void setCardNoQuery(TextField cardNoQuery) {
        this.cardNoQuery = cardNoQuery;
    }

    public void setName(TextField name) {
        this.name = name;
    }

    public void setSex(TextField sex) {
        this.sex = sex;
    }

    public void setMobile(TextField mobile) {
        this.mobile = mobile;
    }

    public void setTel(TextField tel) {
        this.tel = tel;
    }

    public void setAmt(TextField amt) {
        this.amt = amt;
    }

    public void setStatus(TextField status) {
        this.status = status;
    }

    public void setCardNo(TextField cardNo) {
        this.cardNo = cardNo;
    }

    public void setLostBrandName(TextField lostBrandName) {
        this.lostBrandName = lostBrandName;
    }

    public void setLostDate(TextField lostDate) {
        this.lostDate = lostDate;
    }

    public void setLostTime(TextField lostTime) {
        this.lostTime = lostTime;
    }

    public void setLostReason(TextField lostReason) {
        this.lostReason = lostReason;
    }

    public void setUnLostBrandName(TextField unLostBrandName) {
        this.unLostBrandName = unLostBrandName;
    }

    public void setUnLostDate(TextField unLostDate) {
        this.unLostDate = unLostDate;
    }

    public void setUnLostTime(TextField unLostTime) {
        this.unLostTime = unLostTime;
    }

    public void setUnLostReason(TextField unLostReason) {
        this.unLostReason = unLostReason;
    }

    public void setStg(Stage stg) {
        this.stg = stg;
    }

    public void setForward(boolean isForward) {
        this.isForward = isForward;
    }

    public boolean equals(Object o) {
        if (o == this) {
            return true;
        }
        if (!(o instanceof RechargeCardLostController)) {
            return false;
        }
        RechargeCardLostController other = (RechargeCardLostController)o;
        if (!other.canEqual(this)) {
            return false;
        }
        ScrollPane this$scrollPane = this.getScrollPane();
        ScrollPane other$scrollPane = other.getScrollPane();
        if (this$scrollPane == null ? other$scrollPane != null : !this$scrollPane.equals(other$scrollPane)) {
            return false;
        }
        VBox this$vBox = this.getVBox();
        VBox other$vBox = other.getVBox();
        if (this$vBox == null ? other$vBox != null : !this$vBox.equals(other$vBox)) {
            return false;
        }
        TextField this$nameQuery = this.getNameQuery();
        TextField other$nameQuery = other.getNameQuery();
        if (this$nameQuery == null ? other$nameQuery != null : !this$nameQuery.equals(other$nameQuery)) {
            return false;
        }
        TextField this$mobileQuery = this.getMobileQuery();
        TextField other$mobileQuery = other.getMobileQuery();
        if (this$mobileQuery == null ? other$mobileQuery != null : !this$mobileQuery.equals(other$mobileQuery)) {
            return false;
        }
        TextField this$cardNoQuery = this.getCardNoQuery();
        TextField other$cardNoQuery = other.getCardNoQuery();
        if (this$cardNoQuery == null ? other$cardNoQuery != null : !this$cardNoQuery.equals(other$cardNoQuery)) {
            return false;
        }
        TextField this$name = this.getName();
        TextField other$name = other.getName();
        if (this$name == null ? other$name != null : !this$name.equals(other$name)) {
            return false;
        }
        TextField this$sex = this.getSex();
        TextField other$sex = other.getSex();
        if (this$sex == null ? other$sex != null : !this$sex.equals(other$sex)) {
            return false;
        }
        TextField this$mobile = this.getMobile();
        TextField other$mobile = other.getMobile();
        if (this$mobile == null ? other$mobile != null : !this$mobile.equals(other$mobile)) {
            return false;
        }
        TextField this$tel = this.getTel();
        TextField other$tel = other.getTel();
        if (this$tel == null ? other$tel != null : !this$tel.equals(other$tel)) {
            return false;
        }
        TextField this$amt = this.getAmt();
        TextField other$amt = other.getAmt();
        if (this$amt == null ? other$amt != null : !this$amt.equals(other$amt)) {
            return false;
        }
        TextField this$status = this.getStatus();
        TextField other$status = other.getStatus();
        if (this$status == null ? other$status != null : !this$status.equals(other$status)) {
            return false;
        }
        TextField this$cardNo = this.getCardNo();
        TextField other$cardNo = other.getCardNo();
        if (this$cardNo == null ? other$cardNo != null : !this$cardNo.equals(other$cardNo)) {
            return false;
        }
        TextField this$lostBrandName = this.getLostBrandName();
        TextField other$lostBrandName = other.getLostBrandName();
        if (this$lostBrandName == null ? other$lostBrandName != null : !this$lostBrandName.equals(other$lostBrandName)) {
            return false;
        }
        TextField this$lostDate = this.getLostDate();
        TextField other$lostDate = other.getLostDate();
        if (this$lostDate == null ? other$lostDate != null : !this$lostDate.equals(other$lostDate)) {
            return false;
        }
        TextField this$lostTime = this.getLostTime();
        TextField other$lostTime = other.getLostTime();
        if (this$lostTime == null ? other$lostTime != null : !this$lostTime.equals(other$lostTime)) {
            return false;
        }
        TextField this$lostReason = this.getLostReason();
        TextField other$lostReason = other.getLostReason();
        if (this$lostReason == null ? other$lostReason != null : !this$lostReason.equals(other$lostReason)) {
            return false;
        }
        TextField this$unLostBrandName = this.getUnLostBrandName();
        TextField other$unLostBrandName = other.getUnLostBrandName();
        if (this$unLostBrandName == null ? other$unLostBrandName != null : !this$unLostBrandName.equals(other$unLostBrandName)) {
            return false;
        }
        TextField this$unLostDate = this.getUnLostDate();
        TextField other$unLostDate = other.getUnLostDate();
        if (this$unLostDate == null ? other$unLostDate != null : !this$unLostDate.equals(other$unLostDate)) {
            return false;
        }
        TextField this$unLostTime = this.getUnLostTime();
        TextField other$unLostTime = other.getUnLostTime();
        if (this$unLostTime == null ? other$unLostTime != null : !this$unLostTime.equals(other$unLostTime)) {
            return false;
        }
        TextField this$unLostReason = this.getUnLostReason();
        TextField other$unLostReason = other.getUnLostReason();
        if (this$unLostReason == null ? other$unLostReason != null : !this$unLostReason.equals(other$unLostReason)) {
            return false;
        }
        Stage this$stg = this.getStg();
        Stage other$stg = other.getStg();
        if (this$stg == null ? other$stg != null : !this$stg.equals(other$stg)) {
            return false;
        }
        return this.isForward() == other.isForward();
    }

    protected boolean canEqual(Object other) {
        return other instanceof RechargeCardLostController;
    }

    public int hashCode() {
        int PRIME = 59;
        int result = 1;
        ScrollPane $scrollPane = this.getScrollPane();
        result = result * 59 + ($scrollPane == null ? 43 : $scrollPane.hashCode());
        VBox $vBox = this.getVBox();
        result = result * 59 + ($vBox == null ? 43 : $vBox.hashCode());
        TextField $nameQuery = this.getNameQuery();
        result = result * 59 + ($nameQuery == null ? 43 : $nameQuery.hashCode());
        TextField $mobileQuery = this.getMobileQuery();
        result = result * 59 + ($mobileQuery == null ? 43 : $mobileQuery.hashCode());
        TextField $cardNoQuery = this.getCardNoQuery();
        result = result * 59 + ($cardNoQuery == null ? 43 : $cardNoQuery.hashCode());
        TextField $name = this.getName();
        result = result * 59 + ($name == null ? 43 : $name.hashCode());
        TextField $sex = this.getSex();
        result = result * 59 + ($sex == null ? 43 : $sex.hashCode());
        TextField $mobile = this.getMobile();
        result = result * 59 + ($mobile == null ? 43 : $mobile.hashCode());
        TextField $tel = this.getTel();
        result = result * 59 + ($tel == null ? 43 : $tel.hashCode());
        TextField $amt = this.getAmt();
        result = result * 59 + ($amt == null ? 43 : $amt.hashCode());
        TextField $status = this.getStatus();
        result = result * 59 + ($status == null ? 43 : $status.hashCode());
        TextField $cardNo = this.getCardNo();
        result = result * 59 + ($cardNo == null ? 43 : $cardNo.hashCode());
        TextField $lostBrandName = this.getLostBrandName();
        result = result * 59 + ($lostBrandName == null ? 43 : $lostBrandName.hashCode());
        TextField $lostDate = this.getLostDate();
        result = result * 59 + ($lostDate == null ? 43 : $lostDate.hashCode());
        TextField $lostTime = this.getLostTime();
        result = result * 59 + ($lostTime == null ? 43 : $lostTime.hashCode());
        TextField $lostReason = this.getLostReason();
        result = result * 59 + ($lostReason == null ? 43 : $lostReason.hashCode());
        TextField $unLostBrandName = this.getUnLostBrandName();
        result = result * 59 + ($unLostBrandName == null ? 43 : $unLostBrandName.hashCode());
        TextField $unLostDate = this.getUnLostDate();
        result = result * 59 + ($unLostDate == null ? 43 : $unLostDate.hashCode());
        TextField $unLostTime = this.getUnLostTime();
        result = result * 59 + ($unLostTime == null ? 43 : $unLostTime.hashCode());
        TextField $unLostReason = this.getUnLostReason();
        result = result * 59 + ($unLostReason == null ? 43 : $unLostReason.hashCode());
        Stage $stg = this.getStg();
        result = result * 59 + ($stg == null ? 43 : $stg.hashCode());
        result = result * 59 + (this.isForward() ? 79 : 97);
        return result;
    }

    public String toString() {
        return "RechargeCardLostController(scrollPane=" + this.getScrollPane() + ", vBox=" + this.getVBox() + ", nameQuery=" + this.getNameQuery() + ", mobileQuery=" + this.getMobileQuery() + ", cardNoQuery=" + this.getCardNoQuery() + ", name=" + this.getName() + ", sex=" + this.getSex() + ", mobile=" + this.getMobile() + ", tel=" + this.getTel() + ", amt=" + this.getAmt() + ", status=" + this.getStatus() + ", cardNo=" + this.getCardNo() + ", lostBrandName=" + this.getLostBrandName() + ", lostDate=" + this.getLostDate() + ", lostTime=" + this.getLostTime() + ", lostReason=" + this.getLostReason() + ", unLostBrandName=" + this.getUnLostBrandName() + ", unLostDate=" + this.getUnLostDate() + ", unLostTime=" + this.getUnLostTime() + ", unLostReason=" + this.getUnLostReason() + ", stg=" + this.getStg() + ", isForward=" + this.isForward() + ")";
    }
}

